package cn.zxone.feishu.demo.common.exception;


import cn.zxone.feishu.demo.common.enums.ResultCode;
import cn.zxone.feishu.demo.common.pojo.IResultCode;

/**
 * <p>
 * 自定义异常 基类
 * </p>
 *
 * @date 2024-04-29 17:26:01
 */
public class BaseException extends RuntimeException {

    private IResultCode resultCode;

    private Object data;

    public IResultCode getResultCode() {
        return this.resultCode;
    }

    public void setResultCode(IResultCode resultCode) {
        this.resultCode = resultCode;
    }

    public Object getData() {
        return this.data;
    }

    public void setData(Object data) {
        this.data = data;
    }

    public BaseException() {
        super(ResultCode.FAILED.getMessage());
        this.resultCode = ResultCode.FAILED;
    }

    public BaseException(String message) {
        super(message);
        this.resultCode = ResultCode.FAILED;
    }

    public BaseException(Throwable cause) {
        super(cause);
        this.resultCode = ResultCode.FAILED;
    }

    public BaseException(String message, Throwable cause) {
        super(message, cause);
        this.resultCode = ResultCode.FAILED;
    }

    public BaseException(String message, Object data) {
        super(message);
        this.resultCode = ResultCode.FAILED;
        this.data = data;
    }

    public BaseException(String message, Throwable cause, Object data) {
        super(message, cause);
        this.resultCode = ResultCode.FAILED;
        this.data = data;
    }

    public BaseException(IResultCode resultCode) {
        super(ResultCode.FAILED.getMessage());
        this.resultCode = resultCode;
    }

    public BaseException(IResultCode resultCode, String message) {
        super(message);
        this.resultCode = resultCode;
    }

    public BaseException(IResultCode resultCode, Throwable cause) {
        super(ResultCode.FAILED.getMessage(), cause);
        this.resultCode = resultCode;
    }

    public BaseException(IResultCode resultCode, Throwable cause, String message) {
        super(message, cause);
        this.resultCode = resultCode;
    }

    public BaseException(IResultCode resultCode, Throwable cause, String message, Object data) {
        super(message, cause);
        this.resultCode = resultCode;
        this.data = data;
    }

}
